package exam.bak.tencent;

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.concurrent.LinkedBlockingQueue;

public class P5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //1. 录入数据
        int n = Integer.parseInt(scanner.nextLine().trim());
        char[][] board = new char[n][n];
        for (int i = 0; i < n; i++) {
            board[i] = scanner.nextLine().trim().toCharArray();
        }
        //2. 计算
        int count = 0;
        int distance = 0;
        char[][] totalMask = new char[n][n];
        for (int row = 0; row < n; row++) {
            for (int col = 0; col < n; col++) {
                if (board[row][col] != '*') {
                    //1. 计算连通区域
                    char[][] mask = new char[n][n];
                    List<int[]> homeList = new ArrayList<>();
                    area(n, totalMask, board, mask, homeList, row, col);
                    if (homeList.size() == 0) {
                        continue;
                    }
                    count++;
                    //2. 计算距离
                }
            }
        }
        System.out.println(count + " "+ distance);
    }

    static int[][] direction = new int[][]{
            {-1, 0}, {1, 0}, {0, 1}, {0, -1}
    };

    // 找到连通的区间
    private static void area(int n, char[][] totalMask, char[][] board, char[][] mask, List<int[]> homeList, int x, int y) {
        Queue<int[]> queue = new LinkedBlockingQueue<>();
        queue.add(new int[]{x, y});
        mask[x][y] = '.';
        totalMask[x][y] = '*';
        while (!queue.isEmpty()) {
            int[] node = queue.poll();
            for (int[] direct : direction) {
                int nx = node[0] + direct[0];
                int ny = node[1] + direct[1];
                if (0 <= nx && nx <= n && 0 <= ny && ny <= n && board[nx][nx] != '*') {
                    if (board[nx][ny] == '#') {
                        homeList.add(new int[]{nx, ny});
                    }
                    mask[nx][ny] = '.';
                    totalMask[nx][ny] = '*';
                    queue.add(new int[]{nx, ny});
                }
            }
        }
    }

    //计算区间内的最小距离
    private static int distance(int n, char[][] board, char[][] mask, List<int[]> homeList) {

        return 0;
    }
}
